//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <core.h>
#include "registers.h"

//====================================================
// Description  : Print the info. about setup paging
// Parameters   : None
// Return       : None
//====================================================
inline void TestPaging()
{
    kprintf("cr0(control register 0) = 0x%lx\n", GetCr0());
    kprintf("cr4(control register 4) = 0x%lx\n", GetCr4());
    kprintf("cr3(Top-Level Page Directory PA) = 0x%lx\n", GetCr3());
    if (1) {
        // This test is only for paging dir when PAE&PSE disabled...
        uint32_t *pu32Start = (uint32_t *)__VA(GetCr3());
        uint32_t *pu32End   = (uint32_t *)__VA(GetCr3() + c_uSizeOfPageDir);
        while (pu32Start < pu32End) {
            if (0 == *(pu32Start++)) continue;
            kprintf("    Page Tab No.%d : 0x%lx\n", \
                (__PA(pu32Start - 1) - GetCr3()) / sizeof(PageDirEntry), \
                *(pu32Start - 1));
        }
    }
}
